package top.tangs.vitamin.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import top.tangs.vitamin.entity.Productdetails;
import top.tangs.vitamin.util.DBManager;

public class ProductdetailsDaoImpl {
//	查询数据库中的数据
	public List<Productdetails> getUserList() {
		List<Productdetails> list = new ArrayList<Productdetails>();
		// 1获取连接
		Connection conn = DBManager.getConnection();
		Statement st = null;
		ResultSet rs = null;
		try {
			// 2创建statement对象(执行SQL语句)
			st = conn.createStatement();
			// 3。SQL语句
			String sql = "select s.InformationParticularsId,n.informationClassificationName,s.InformationParticularsTitle,s.InformationParticularsContent,\r\n"
					+ "s.InformationParticularsContent \r\n"
					+ "from informationparticulars s,informationclassification n \r\n"
					+ "where s.InformationParticularsClassification=n.informationClassificationID";

			// 4.执行SQL语句
//		st.executeQuery(sql);//

			rs = st.executeQuery(sql);//

//		5.便利结果集;
			while (rs.next()) {
				String uname = rs.getString("s.InformationParticularsId");
				String password = rs.getString("n.informationClassificationName");
				Productdetails productdetails = new Productdetails();
				list.add(productdetails);
			}
			return list;
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		} finally {
			DBManager.closeAll(conn, st, rs);
		}

	}
	
	
	
	
	
	
	
//	int id = rs.getInt("productID");	 int productPrice;
//	int id = rs.getInt("productID");	 int productMarketPrice;
//	String id = rs.getString("productID");	 String productFlatPattern;
//	String id = rs.getString("productID");	 String productExplain;
//	String id = rs.getString("productID"); String productDetailedDescription;
//	String id = rs.getString("productID");	private String productDrand;
//	String id = rs.getString("productID");	private String productVersion;
//	String id = rs.getString("productID");	private String productStyle;
//	char id = rs.getCharacterStream("productID");	private char productKDorNot;
//	String id = rs.getString("productID");	private String productColorClassification;
//	String id = rs.getString("productID");	private String productInscribePositioning;
//	char id = rs.getCharacterStream("productID");	private char productCustomDesign;
//	String id = rs.getString("productID");	private String productDesignElement;
//	int id = rs.getInt("productID");	private int productTheCategory;
//	String id = rs.getString("productID");	private String informationClassificationName;
	
	
	
	
	
}
